package xyz.twj.micro.service.dao;

import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import xyz.twj.micro.service.enties.UserEntity;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

/**
 * 继承JpaRepository 简单查询 ， JpaSpecificationExecutor复杂查询
 */
public interface UserRepository extends JpaRepository<UserEntity, Integer>, JpaSpecificationExecutor, QuerydslPredicateExecutor {

    class QuerySpecification implements Specification<UserEntity> {
        @Override
        public Predicate toPredicate(Root<UserEntity> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
            return null;
        }
    }
}
